package com.common.impl;

import java.util.List;

import net.sf.json.JSONArray;

import com.common.dao.UserDAO;
import com.common.model.User;
import com.common.service.UserService;


public class UserServiceImpl implements UserService {
	private UserDAO userdao;
	
	@Override
	public boolean reg(User user) {
		return userdao.reg(user);
	}
	
	@Override
	public User bLogin(String username, String password) {
		User user = userdao.bLogin(username, password);
		if(user == null){
			return null;
		}else{
			return user;
		}
	}
	
	@Override
	public User wLogin(String username, String password) {
		User user = userdao.wLogin(username, password);
		if(user == null){
			return null;
		}else{
			return user;
		}
	}
	
	@Override
	public List<User> list_baoxiu() {
		return userdao.list_baoxiu();
	}
	
	@Override
	public List<User> list_weixiu() {
		return userdao.list_weixiu();
	}
	
	//模糊查询
	@Override
	public List<User> search(String name) {
		return userdao.list(name);
	}
	
	@Override
	public void wDel(User user) {
		userdao.wDel(user);
	}
	
	@Override
	public void bDel(User user) {
		userdao.bDel(user);
	}
	
	@Override
	public User load(int id) {
		return userdao.load(id);
	}
	
	@Override
	public boolean bupdate(User user) {
		return userdao.bupdate(user);
	}
	
	//根据用户名进行查找
	@Override
	public List<User> list0(String username) {
		return userdao.list0(username);
	}
	
	
	
	
	@Override
	public User login(String username, String password) {
		User user = userdao.login(username, password);
		if(user == null){
			return null;
		}else{
			return user;
		}
	}
	
	
	public UserDAO getUserdao() {
		return userdao;
	}
	public void setUserdao(UserDAO userdao) {
		this.userdao = userdao;
	}
}
